<?php
//查询数据库数据
require  'db_con.php';//(1)数据库连接  include
$sql="select * from tb_emp";
$result=$db->query($sql);//执行
if (isset($_GET['search']))
     {
     $search=$_GET['search'];
     $sql="select * from tb_emp where (e_name like '%{$search}%') or (e_dept like '%{$search}%') ";//按关键字进行搜索 
     }
     else
     {
     $search="";
     $sql="select * from tb_emp  "; 
        }
$result=$db->query($sql);
$bbsdata=$result->fetch_all(MYSQLI_ASSOC);
$result->free_result();
$db->close();//关闭数据库连接
require 'list_html.php';
